/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package threads;

/**
 *
 * @author Bertil
 */
public class Konsument implements Runnable{

public Thread activity = new Thread(this); //gör objektet till en tråd
private long interval;
private XSimpleQueue q;

public Konsument(long time, XSimpleQueue k){
    interval = time*1000;
    q = k;
}

    public void run(){
        while(XThread.delay(interval)){
            System.out.println(q.take());
            System.out.flush();
        }

    }
}
